﻿@using Pay.Token.Utils
@model PagedResult<product_dto>
@{ string site_img = ViewBag.img_url;}
@{
    if (Model.rows.Count > 0) {
        foreach (var item in Model.rows) {
            <div class="item" style="position: absolute; left: 0px; top: 0px;">
                <a href="@((item.activity_ex != null
                && (item.activity_ex.begin_time <= DateTime.Now || (item.activity_ex.preheat_time != null && item.activity_ex.preheat_time <= DateTime.Now)) && item.activity_ex.end_time >= DateTime.Now)
                            ? "/DistributionMall/ProductDetail?productId=" + item.id :"javascript:void(0)")">
                    <div class="itemBox">
                        <div class="img relative">
                            @if (item.activity_ex != null && item.activity_ex.begin_time > DateTime.Now) {
                                <div class="time absolute">@(item.activity_ex.begin_time.ToString("MM-dd HH:mm")) 开始兑换</div>
                            } else if (item.activity_ex != null && item.activity_ex.is_sold_out == true) {
                                <div class="time absolute">已售罄</div>
                            } else if (item.activity_ex != null && item.activity_ex.begin_time <= DateTime.Now && item.activity_ex.end_time >= DateTime.Now) {
                                <div class="time timeOn absolute">兑换中</div>
                            } else {
                                <div class="time absolute">已结束</div>
                            }

                            <img src="@item.main_image_url">
                        </div>
                        <div class="box">
                            <p class="tit">@item.name</p>
                            <div class="">
                                <p>
                                    <span class="through col-gray">
                                        <em class="fn20">￥</em>
                                        <em class="fn25">@item.market_price.ToString("f2")</em>
                                    </span>
                                </p>
                                <p>
                                    <span class="col-red">
                                        <em class="fn22">兑换</em>
                                        <em class="fn32">@item.activity_ex.activity_red_drill.ToString("0.######")</em>
                                    </span>
                                </p>
                            </div>

                        </div>
                    </div>
                </a>
            </div>
        }
    }

    <page total_pages="@Model.total_pages" rows="@Model.rows.Count()" total_result="@Model.total_result"></page>
}



